import { get } from '../utils/http/request';

/**
 * 获取医院列表
 * @param params 查询参数
 * @returns 医院列表数据
 */
export function getHospitalList(params: PageQuery): Promise<ApiResponse<PageResult<Hospital>>> {
  return get('/hospital/list', params);
}

/**
 * 获取医院详情
 * @param id 医院ID
 * @returns 医院详情
 */
export function getHospitalDetail(id: number): Promise<ApiResponse<Hospital>> {
  return get(`/hospital/${id}`);
}

/**
 * 获取医院科室列表
 * @param hospitalId 医院ID
 * @returns 科室列表
 */
export function getDepartmentList(hospitalId: number): Promise<ApiResponse<Department[]>> {
  return get(`/hospital/${hospitalId}/departments`);
}

/**
 * 获取科室详情
 * @param hospitalId 医院ID
 * @param departmentId 科室ID
 * @returns 科室详情
 */
export function getDepartmentDetail(hospitalId: number, departmentId: number): Promise<ApiResponse<Department>> {
  return get(`/hospital/${hospitalId}/department/${departmentId}`);
}

/**
 * 获取医院医生列表
 * @param params 查询参数
 * @returns 医生列表
 */
export function getDoctorList(params: {
  hospitalId?: number;
  departmentId?: number;
  page: number;
  pageSize: number;
}): Promise<ApiResponse<PageResult<Doctor>>> {
  return get('/doctor/list', params);
}

/**
 * 获取医生详情
 * @param id 医生ID
 * @returns 医生详情
 */
export function getDoctorDetail(id: number): Promise<ApiResponse<Doctor>> {
  return get(`/doctor/${id}`);
}

/**
 * 获取所有科室分类
 * @returns 科室分类列表
 */
export function getAllDepartments(): Promise<ApiResponse<Department[]>> {
  return get('/departments');
}

/**
 * 获取推荐医生列表
 * @param hospitalId 医院ID
 * @param limit 获取数量，默认5
 * @returns 推荐医生列表
 */
export function getRecommendedDoctors(hospitalId: number, limit: number = 5): Promise<ApiResponse<Doctor[]>> {
  return get(`/hospital/${hospitalId}/recommendedDoctors`, { limit });
} 